package com.wn.myrule;


import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//自己的组件不可以放到SpringBootApplication同级目录下，否则不会生效
@Configuration
public class MyRule {

    //自定义实现负载均衡方式
    @Bean
    public IRule MyRule(){
        return new RandomRule();
    }
}
